/**
 * toast 提示插件
 */
;(function ($) {
    'use strict';

    $.toast = function (text, callback) {
        text = text || '操作成功';
        $(`<div class="m-toast-mask"></div><div class="m-toast-text">${text}</div>`).appendTo(document.body);
        setTimeout(() => {
            //- 关闭提示
            $('.m-toast-mask, .m-toast-text').remove();
            //- 回调函数
            if (callback ) callback(this);
        }, toastDefaults.duration);
    };
    var toastDefaults = $.toast.prototype.defaults = {
        duration: 1800
    };
})($);